﻿<phone:PhoneApplicationPage
    x:Class="GrimorioApplication.Views.ListRecipes"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
    xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:toolkit="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls.Toolkit"
    FontFamily="{StaticResource PhoneFontFamilyNormal}"
    FontSize="{StaticResource PhoneFontSizeNormal}"
    Foreground="{StaticResource PhoneForegroundBrush}"
    SupportedOrientations="Portrait" Orientation="Portrait"
    mc:Ignorable="d"
    shell:SystemTray.IsVisible="True">

    <!-- INSERIRE DATA TEMPLATE PER LA LongListSelector -->
    <phone:PhoneApplicationPage.Resources>
        <DataTemplate x:Key="RecipeLongListSelectorTemplate">
            <Grid>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width=".2*"/>
                    <ColumnDefinition Width=".8*"/>
                </Grid.ColumnDefinitions>
                <Image x:Name="recipeImageList" Source="/Img/Grimorio_62_62_gray-01.png" Width="auto" Height="auto" HorizontalAlignment="Center" VerticalAlignment="Center" Grid.Column="0"/>
                <Grid Margin="0,0,0,15" Grid.Column="1">
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width=".7*"/>
                        <ColumnDefinition Width=".3*"/>
                    </Grid.ColumnDefinitions>
                    <Grid.RowDefinitions>
                        <RowDefinition Height="auto"/>
                        <RowDefinition Height="auto"/>
                    </Grid.RowDefinitions>
                    <!-- Definition of listElement: due righe, due colonne. -->
                    <!-- Nome TEMPO-->
                    <!-- Valutazione -->
                    <TextBlock x:Name="recipeNameTextblockList" FontSize="30" HorizontalAlignment="Left" Grid.Row="0" Grid.Column="0" Text="{Binding Path=RecipeName}" />
                    <TextBlock x:Name="recipeDifficultyTextblockList" HorizontalAlignment="Left" Grid.Row="1" Grid.Column="1" Text="{Binding Path=Difficulty}" FontSize="24" Margin="5,0" />
                    <TextBlock x:Name="recipeTimeTextblockList" HorizontalAlignment="Left" Grid.Row="0" Grid.Column="1" Text="{Binding Path=TimeForPreparation}" FontSize="24"/>
                    <!-- To bind with double value -->
                    <toolkit:Rating x:Name="recipeRatingList" HorizontalAlignment="Left" Grid.Row="1" Grid.Column="0" ReadOnly="True" Value="{Binding Path=Rating}"/>
                </Grid>
            </Grid>
        </DataTemplate>
    </phone:PhoneApplicationPage.Resources>

    <!--LayoutRoot is the root grid where all page content is placed-->
    <Grid x:Name="LayoutRoot" Background="Transparent">
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="*"/>
        </Grid.RowDefinitions>

        <!--TitlePanel contains the name of the application and page title-->
        <StackPanel Grid.Row="0" Margin="12,17,0,28">
            <TextBlock Text="GRIMORIO" Style="{StaticResource PhoneTextNormalStyle}"/>
            <TextBlock Text="{Binding LocalizedResources.lbl_recipes, Source={StaticResource LocalizedStrings}}" Margin="9,-7,0,0" Style="{StaticResource PhoneTextTitle1Style}"/>
        </StackPanel>

        <!--ContentPanel - place additional content here-->
        <Grid x:Name="ContentPanel" Grid.Row="1" Margin="12,0,12,0">
            
            <!-- Listbox contenente tutte le ricette dell'applicazione -->
            <Grid x:Name="GridContentOfThePage">
                <toolkit:LongListSelector
                    IsBouncy="False"
                    IsFlatList="True"
                    ItemTemplate="{StaticResource RecipeLongListSelectorTemplate}"
                    x:Name="listSelectorOfRecipes" SelectionChanged="listSelectorOfRecipes_SelectionChanged_1">
                    
                </toolkit:LongListSelector>
            </Grid>
        </Grid>
    </Grid>

</phone:PhoneApplicationPage>